package com.example.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class ProviderController {

    @Value("${spring.application.name}")
    private String applicationName;

    @Value("${server.port}")
    private String port;

    @GetMapping("/info")
    public String getProviderInfo(){
        return applicationName + "-" + port +" -01";
    }


    @GetMapping("/testTimeout")
    public String testTimeout(){

        try{
            TimeUnit.SECONDS.sleep(5);
        }catch (Exception e) {
            e.printStackTrace();
        }
        return applicationName + "-" + port +" test time out 01";
    }

}
